package com.xuecheng.framework.interceptor;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截器全局管理配置
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private VerifyPageableInterceptor verifyPageableInterceptor;

    /**
     * 将需要的拦截方法加入
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 添加拦截器，配置拦截请求

        //拦截所有的分页查询
        registry.addInterceptor(verifyPageableInterceptor).addPathPatterns("/**/list/**").excludePathPatterns();
    }
}
